package com.mediacloud.app.newsmodule.fragment.simulcast

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.eventTrack.CDPTrackReportManager
import com.facebook.drawee.view.SimpleDraweeView
import com.mediacloud.app.assembly.util.loadByFresco
import com.mediacloud.app.assembly.util.loadX
import com.mediacloud.app.assembly.views.CCTV7ImageView
import com.mediacloud.app.model.news.ArticleItem
import com.mediacloud.app.model.news.CatalogItem
import com.mediacloud.app.newsmodule.R
import com.mediacloud.app.newsmodule.utils.NewsItemClickUtils

class SimulcastZXAdapter : BaseQuickAdapter<SimulcastV2Bean,BaseViewHolder>(R.layout.item_zx) {
    override fun convert(helper: BaseViewHolder, item: SimulcastV2Bean) {
        val logo = helper.getView<CCTV7ImageView>(R.id.logo)
        val tvtitle = helper.getView<TextView>(R.id.tvtitle)
        logo.loadX(item.logo,2,1,false)
        tvtitle.text = item.title
        val articleItem = ArticleItem()
        articleItem.id = item.id
        articleItem.type = item.type
        articleItem.catalogId = item.catalogId
        articleItem.publishdate = item.publishDate
        articleItem.referName = item.referName
        articleItem.title = item.title
        articleItem.logo = item.logo
        articleItem.Author = item.author
        articleItem.authorId = item.authorId
        articleItem.authorNickName = item.authorNickName
        helper.itemView.setOnClickListener {
            CDPTrackReportManager.getInstance().NewsRPClick(helper.absoluteAdapterPosition,articleItem)
            NewsItemClickUtils.OpenItemNewsHandle(it.context,item.type,articleItem, CatalogItem())
        }
    }
}